<#include "../common/layout.ftl"/>
<@layout>
<div width="100%">
	<div class="dxfsqd_title">开票管理</div>
	<div class="dxfsqd_shearch">
		<form method="post" action="/invoice/invoiceList" class="form-inline">
			<label><span>公司抬头</span><input type="text" class="input-medium" style="height: 30px"  name="company_name" value="${company_name?if_exists}"/></label> 
			<button type="submit" class="btn btn-primary"><i class="icon-search icon-white"></i>查询</button>
	    	<#if session.userRole == 'admin' || session.userRole == 'brandManager'>
	    		<label><span>导出</span><a class="dc_exc" href="/invoice/excel">导出Excel文件</a></label>
	    	</#if>
		</form>
</div>
<div class="dxfsqd_table">

	<table class="table table-bordered table-striped">
		<thead>
		  <tr>
			<th scope="col">编号</th>
			<th scope="col">订单来源</th>
			<th scope="col">订单号</th>
			<th scope="col">公司抬头</th>
			<th scope="col">收件地址</th>
			<th scope="col">联系人</th>
			<th scope="col">电话</th>
			<th scope="col">金额</th>
			<th scope="col">状态</th>
			<th scope="col">备注</th>
			<th scope="col">操作</th>
		  </tr>
		</thead>
		<tbody>
		<#list page.list as invoice>
		  <tr>
			<td>
			 ${invoice.id!""}
			</td>
			<td>
			  <#if invoice.job_number??>
			  ${invoice.job_number}
			  </#if>
			</td>
			<td>
			 ${invoice.order_id!""}
			</td>
			<td>
			 ${invoice.company_name!" "}
			</td>
			<td>
			 ${invoice.address!" "}
			</td>
			<td>
			 ${invoice.person_name!" "}
			</td>
			<td>
			 ${invoice.phone!" "}
			</td>
			<td>
			 ${invoice.money!""}
			</td>
			<td>
			  <#if invoice.state == 0>
			     未开票
			  <#else>
			     已开票
			  </#if>
			</td>
			<td>
			 ${invoice.remark!""}
			</td>
			<td>
			 <#if invoice.state == 0>
			 	 <#if session.userRole == 'admin' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
			     	<a class="cf" href="/invoice/doMakeInvoice/${invoice.id}"  >开票</a>
			     </#if>
			 </#if>
			</td>
		  </tr>
		</#list>
		</tbody>
	</table>
	<#include "../common/paginate.ftl" />
	<@paginate currentPage=page.pageNumber totalPage=page.totalPage actionUrl="/order/invoiceList/" />
</div>
</div>

</@layout>